package com.xwj.xuthread.spring.parser;

import org.yaml.snakeyaml.Yaml;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
/**
 * @Author: XuWenjie
 * @Date: 2025-08-25
 * @Description: YamlParser
 */
public class YamlParser<T> {

    public static InputStream convertStringToInputStream(String str) {
        // 将字符串转换为字节数组，使用UTF-8编码
        byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
        // 创建并返回ByteArrayInputStream
        return new ByteArrayInputStream(bytes);
    }

    public static <T> T parseYaml(String content, Class<T> clazz) {
        Yaml yaml = new Yaml();
        Object object = yaml.load(content);
        //yaml.loadAs()
        return null;
    }
}
